home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / ATL_Samples / polycntr / polydlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  2.4 KB  |  84 lines

  1. // PolyDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "PolyCntr.h"
  6. #include "PolyDlg.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CPolyCntrDlg dialog
  16.  
  17. CPolyCntrDlg::CPolyCntrDlg(CWnd* pParent /*=NULL*/)
  18.     : CDialog(CPolyCntrDlg::IDD, pParent)
  19. {
  20. // MM not needed in wce dialogs:    ON_WM_
  21.     //{{AFX_DATA_INIT(CPolyCntrDlg)
  22.         // NOTE: the ClassWizard will add member initialization here
  23.     //}}AFX_DATA_INIT
  24.     // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  25.     m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  26. }
  27.  
  28. void CPolyCntrDlg::DoDataExchange(CDataExchange* pDX)
  29. {
  30.     CDialog::DoDataExchange(pDX);
  31.     //{{AFX_DATA_MAP(CPolyCntrDlg)
  32.         // NOTE: the ClassWizard will add DDX and DDV calls here
  33.     DDX_Control(pDX, IDC_POLYCTL1, m_Polygon); 
  34.     //}}AFX_DATA_MAP
  35. }
  36.  
  37. BEGIN_MESSAGE_MAP(CPolyCntrDlg, CDialog)
  38.     //{{AFX_MSG_MAP(CPolyCntrDlg)
  39.     //}}AFX_MSG_MAP
  40. END_MESSAGE_MAP()
  41.  
  42. /////////////////////////////////////////////////////////////////////////////
  43. // CPolyCntrDlg message handlers
  44.  
  45. BOOL CPolyCntrDlg::OnInitDialog()
  46. {
  47.     CDialog::OnInitDialog();
  48.  
  49.     // Workaround needed on 7258 version of MFC in ROM.  Needed so that events
  50.     // fired from ATL are handled correctly.
  51.     // Note: m_Polygon must already be attached to a window.
  52.     ATLConnectSinks(&m_Polygon); 
  53.  
  54.     // Set the icon for this dialog.  The framework does this automatically
  55.     //  when the application's main window is not a dialog
  56.     SetIcon(m_hIcon, TRUE);            // Set big icon
  57.     SetIcon(m_hIcon, FALSE);        // Set small icon
  58.     
  59.     CenterWindow(GetDesktopWindow());    // center to the hpc screen
  60.  
  61.     // TODO: Add extra initialization here
  62.     
  63.     return TRUE;  // return TRUE  unless you set the focus to a control
  64. }
  65.  
  66. BEGIN_EVENTSINK_MAP(CPolyCntrDlg, CDialog)
  67.     //{{AFX_EVENTSINK_MAP(CPolyContDlg)
  68.     ON_EVENT(CPolyCntrDlg, IDC_POLYCTL1, 1 /* ClickIn */, OnClickInPolyctl1, VTS_I4 VTS_I4)
  69.     ON_EVENT(CPolyCntrDlg, IDC_POLYCTL1, 2 /* ClickOut */, OnClickOutPolyctl1, VTS_I4 VTS_I4)
  70.     //}}AFX_EVENTSINK_MAP
  71. END_EVENTSINK_MAP()
  72.  
  73. void CPolyCntrDlg::OnClickInPolyctl1(long x, long y) 
  74. {
  75.    m_Polygon.SetSides(m_Polygon.GetSides() + 1);
  76. }
  77.  
  78. void CPolyCntrDlg::OnClickOutPolyctl1(long x, long y) 
  79. {
  80.     short nSides = m_Polygon.GetSides();
  81.    if(nSides > 3)
  82.       m_Polygon.SetSides(nSides - 1);
  83. }
  84.